
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import oracle.jdbc.driver.OracleDriver;

public class VEntregas extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        try {
            ConexionBD con = new ConexionBD();
            Connection OJDBC_con = con.DBConect();
            Statement s = OJDBC_con.createStatement();
            String query = "select * from tbm_proveedores ORDER BY prov_id";
            // String query = "select * from clientes where cod_cliente='" +cod+"'";
            ResultSet rs = s.executeQuery(query);

            //Display the result set in an HTML table
            // out.println("<h2>Se encontro "+cod+"</h2>" +
            //             "<HTML><body background='wallpapers/Hoja-verde.jpg'><font color='white'>" +
            //            "<table><tr><th>los datos son:</th>");
            out.println("<HTML <font size=+4 color='white'><body background='images/Fondo-Gris.jpg'>"
                    + "<head>"
                    + "<meta charset='utf-8'>"
                    + "<title>BDR-System</title>"
                    + "<link rel='stylesheet' href='css/style.css' type='text/css' media='screen' />"
                    + "<link rel='stylesheet' href='css/social-icons.css' type='text/css' media='screen' />"
                    + "<script type='text/javascript' src='js/jquery-1.5.1.min.js'></script>"
                    + "<script type='text/javascript' src='js/jquery-ui-1.8.13.custom.min.js'></script>"
                    + "<script type='text/javascript' src='js/easing.js'></script>"
                    + "<script type='text/javascript' src='js/jquery.scrollTo-1.4.2-min.js'></script>"
                    + "<script type='text/javascript' src='js/jquery.cycle.all.js'></script>"
                    + "<script type='text/javascript' src='js/custom.js'></script>"
                    + "<script src='js/jquery.isotope.min.js'></script>"
                    + "<link rel='stylesheet' href='css/nivo-slider.css' type='text/css' media='screen' />"
                    + "<script src='js/nivo-slider/jquery.nivo.slider.js' type='text/javascript'></script>"
                    + "<link rel='stylesheet' href='css/tabs.css' type='text/css' media='screen' />"
                    + "<script type='text/javascript' src='js/tabs.js'></script>"
                    + "<script type='text/javascript' src='js/prettyPhoto/js/jquery.prettyPhoto.js'></script>"
                    + "<link rel='stylesheet' href='js/prettyPhoto/css/prettyPhoto.css' type='text/css' media='screen' />"
                    + "<link rel='stylesheet' media='screen' href='css/superfish.css' /> "
                    + "<link rel='stylesheet' media='screen' href='css/superfish-left.css' /> "
                    + "<script type='text/javascript' src='js/superfish-1.4.8/js/hoverIntent.js'></script>"
                    + "<script type='text/javascript' src='js/superfish-1.4.8/js/superfish.js'></script>"
                    + "<script type='text/javascript' src='js/superfish-1.4.8/js/supersubs.js'></script>"
                    + "<link rel='stylesheet' href='js/poshytip-1.0/src/tip-twitter/tip-twitter.css' type='text/css' />"
                    + "<link rel='stylesheet' href='js/poshytip-1.0/src/tip-yellowsimple/tip-yellowsimple.css' type='text/css' />"
                    + "<script type='text/javascript' src='js/poshytip-1.0/src/jquery.poshytip.min.js'></script>"
                    + "<link rel='stylesheet' href='css/jquery.tweet.css' media='all'  type='text/css'/>"
                    + "<script src='js/tweet/jquery.tweet.js' type='text/javascript'></script> "
                    + "<link rel='stylesheet' href='js/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css' type='text/css' media='screen' />"
                    + "<script type='text/javascript' src='js/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js'></script>"
                    + "</head>"
                    + "<body>"
                    + "<div id='header'>"
                    + "<div class='wrapper'>"
                    + "<a href='Inicio.jsp'><img id='logo' src='img/logo.png' alt='Nova' /></a>"
                    + "<div class='top-search'>"
                    + "<form  method='get' id='searchform' action='#'>"
                    + "<div>"
                    + "<input type='text' value='Search...' name='s' id='s' onfocus='defaultInput(this)' onblur='clearInput(this)' />"
                    + "<input type='submit' id='searchsubmit' value=' ' />"
                    + "</div>"
                    + "</form>"
                    + "</div>"
                    + "</div>"
                    + "</div>"
                    + "<div id='menu'>"
                    + "<div id='menu-holder'>"
                    + "<div class='wrapper'>"
                    + "<ul id='nav' class='sf-menu'>"
                    + "<li class='current-menu-item'><a href='Inicio.jsp'>Inicio<span class='subheader'>o.O</span></a></li>"
                    + "<li><a href='Catalogos.html'>Catalogos<span class='subheader'>Gestion de Registros</span></a>"
                    + "<ul>"
                    + "<li><a href='Catalogo-Clientes.html'><span> Clientes</span></a></li>"
                    + "<li><a href='Catalogo-Proveedores.html'><span> Proveedores</span></a></li>"
                    + "<li><a href='Catalogo-Inventario.html'><span> Materia Prima</span></a></li>"
                    + "</ul>"
                    + "</li>"
                    + "<li><a href='docTrabajos.html'>Documentos de Trabajo<span class='subheader'>O.o</span></a>"
                    + "<ul>"
                    + "<li><a href='DT-Cotizacion.html'><span> Crear Cotizacion</span></a></li>"
                    + "<li><a href='DT-Orden.html'><span> Crear Orden de Trabajo</span></a></li>"
                    + "<li><a href='DT-Resgistros.html'><span> Visualizar Registros</span></a></li>"
                    + "</ul>"
                    + "</li>"
                    + "<li><a href='Facturacion.html'>Facturacion<span class='subheader'></span></a>"
                    + "<ul>"
                    + "<li><a href='Fact-Generar.html'><span> Crear Factura</span></a></li>"
                    + "<li><a href='Fact-Registros.html'><span> Visualizar Registros </span></a></li>"
                    + " <li><a href='Fact-Entregas.html'><span> Programar Entregas </span></a></li>"
                    + "</ul>"
                    + "</li>"
                    + "<li><a href='Financiera.html'>Area Financiera<span class='subheader'>Creditos, Compra...</span></a>"
                    + "<ul>"
                    + "<li><a href='Fi-Creditos.html'><span> Creditos</span></a></li>"
                    + "<li><a href='Fi-Gastos.html'><span> Gastos</span></a></li>"
                    + "</ul>"
                    + "</li>"
                    + "<li><a href='Reportes.html'>Reportes<span class='subheader'>Registros, Graficos y Estadisticas</span></a></li>"
                    + "</div>"
                    + "</div>"
                    + "</div>"
                    + "<div id='main'>"
                    + "<div class='wrapper'>"
                    + "<div id='content'>"
                    + "<div id='page-title'>"
                    + "<span class='title'>Tabla de Registros de entrega</span>"
                    + "</div>"
                    // +"<p>&nbsp;</p> <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
                    + "<div align=center><table border='5'>");

            out.println("<TR><tr><TD align=center><b><font size=5 > Codigo </font></b></TD>"
                    + "    <TD width=150 align=center><b><font size=5 >   Fecha Programada   </font></b></TD>"
                    + "    <TD width=150 align=center><b><font size=5 >   Encargado Panel   </font></b></TD>"
                    + "    <TD width=150 align=center><b><font size=5 >   Fecha de Entrega   </font></b></TD>");
                    //+ "    <TD width=150 align=center><b><font size=5 >   Direccion   </font></b></TD>"
                    //+ "    <TD width=150 align=center><b><font size=5 >   Telefono   </font></b></TD>"
                    //+ "    <TD width=150 align=center><b><font size=5 >   Email  </font></b></TD>"
                   // + "    <TD width=150 align=center><b><font size=5 >   Estado   </font></b></TD>");

            while (rs.next()) {
                String codigo = rs.getString("doce_id");
                //String codp = rs.getString("DOCE_ID");
                String nit = rs.getString("DOCE_FECHA_PROGRAMADA");
                String nom = rs.getString("DOCE_ENCARGADO_PANEL");
                String contacto = rs.getString("DOCE_FECHA_ENTREGA");
                //String direccion = rs.getString("CLI_DIRECCION");
                //String telefono = rs.getString("CLI_TELEFONO");
                //String email = rs.getString("CLI_EMAIL");
                //String estado = rs.getString("CLI_ESTADO");
                System.out.print("muestra datos:  " + codigo + nit + nom + contacto);

                out.println("<TR><TD align=center><b><font size=5 > " + codigo + "</font><b></TD>"
                        + "    <TD align=center><b><font size=5 > " + nit + "</font><b></TD>"
                        + "    <TD align=center><b><font size=5 > " + nom + "</font><b></TD>"
                        + "    <TD align=center><b><font size=5 > " + contacto + "</font><b></TD>");
                        //+ "    <TD align=center><b><font size=5 > " + direccion + "</font><b></TD>"
                        //+ "    <TD align=center><b><font size=5 > " + telefono + "</font><b></TD>"
                        //+ "    <TD align=center><b><font size=5 > " + email + "</font><b></TD>"
                        //+ "    <TD align=center><b><font size=5 > " + estado + "</font><b></TD>");

            }
            out.println("</table></div><br><p align=center ><a href=inicio.jsp <img border = 0 src=imagenes_de_botones/botonmenu.png /></p>");
            out.println(
                    "</div>"
                    + "	</div>"
                    + "</div>"
                    + "<div id='twitter'>"
                    + "<div class='wrapper'>"
                    + "<a href='#' id='prev-tweet'></a>"
                    + "<a href='#' id='next-tweet'></a>"
                    + "<img id='bird' src='img/bird.png' alt='Tweets' />"
                    + "<div id='tweets'>"
                    + "<ul class='tweet_list'></ul>"
                    + "</div>"
                    + "</div>"
                    + "</div>"
                    + "<div id='bottom'>"
                    + "<div class='wrapper'>"
                    + "<div id='bottom-text'>2013 all rights reserved.</div>"
                    + "</div>"
                    + "</body>");
            OJDBC_con.close();

        } catch (Exception e) {
            out.println(e);
        }

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //processRequest(request, response);
    }

    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
